package com.cskaoyan.util;

/**
 * @author jzp
 * @since 2022/11/22 21:27
 */
public class SymmetricEncryption {
    private static Integer keys = 9;

    public static String encryption(String clear) {
        StringBuilder cipher = new StringBuilder();
        char[] clearArray = clear.toCharArray();
        for (char ele : clearArray) {
            ele += keys;
            cipher.append(ele);
        }
        return cipher.toString();
    }

    public static String decryption(String cipher) {
        StringBuilder clear = new StringBuilder();

        char[] clearArray = cipher.toCharArray();
        for (char ele : clearArray) {
            ele -= keys;
            clear.append(ele);
        }
        return clear.toString();
    }
}
